<template>
  <base-page-view :show-to-top="false">
    <view class="header-container">
      <base-nav title="订单详情">
        <view slot="left" class="header-left" @click="leftClick">
          <image src="/static/images/icon/icon_arror_left.png" />
        </view>
      </base-nav>
    </view>
    <view class="order-detail">
      <view class="detail-check-container">
        <view v-if="orderStatus === '待发货' || orderStatus === '待收货' || orderStatus === '订单已签收' || orderStatus === '已完成' || orderStatus === '订单成功'" class="top-tip">
          <image class="top-tip-icon" src="/static/images/order/icon_message.png"></image>
          凡是自称快递、商家客服主动联系您购物退款，都是诈骗！
        </view>
        <view class="tips" :class="{'grey': orderStatus === '已取消'}">
          <view class="orderStatusBox">
            <image v-if="orderObject.status" :src="orderStateIcon" mode="aspectFit" />
            <view class="o-p textFloor">
              <text>{{ orderStatus }}</text>
              <!-- <text >{{ `(剩${payExpiry}自动取消订单)` }}</text> -->
              <view v-if="orderStatus === '待付款'" class="o-span">请在<count-down color="#fff" splitor-color="#fff" padding="0" margin="0" :second="orderObject.pay_expiry" :show-day="false" :show-hour="false" @timeup="callBack" />内进行支付，超时订单将取消</view>
              <text v-if="orderStatus === '待收货'" class="o-span">商品已在路上，请耐心等待!</text>
              <text v-if="orderStatus === '待发货'" class="o-span">您的订单已导入, 商家正通知快递公司取件</text>
              <text v-if="orderStatus === '待分享' && orderObject.diff_people_num > 0" class="o-span">还差{{ orderObject.diff_people_num }}人即可成团</text>
              <text v-if="orderObject.status === 5" class="o-span">取消原因: 用户取消订单</text>
              <text v-if="orderObject.status === 7" class="o-span">您的订单已取消,取消原因订单支付超时取消</text>
            </view>
          </view>
        </view>
        <view class="consignee">
          <view v-if="orderObject && orderObject.express_list">
            <view v-for="(item, index) in orderObject.express_list" :key="index" class="expressItem padding-32">
              <view class="expressDetail" @click="toOrderExpress(index)">
                <view class="info">
                  <view v-if="orderObject.express_list && orderObject.express_list.length>0" class="o-span">
                    <image src="/static/images/order/icon_car.png" mode="aspectFit" />
                    <!--  -->
                  </view>
                <!--<span>{{item.name}}: {{item.express_no}}</span>-->
                </view>
                <view v-if="item.express_message_list && item.express_message_list.length > 0">
                  <block v-for="(sitem, sindex) in item.express_message_list" :key="sindex">
                    <view v-if="sindex === 0" class="leftItem">
                      <view class="o-p">【包裹{{ index+1 }}】 {{ sitem.msg }}</view>
                      <text class="o-small">{{ sitem.create_time | parseTime }}</text>
                    </view>
                  </block>
                </view>
                <view v-else-if="item.express_message_list && item.express_message_list.length === 0" class="leftItem">
                  <view class="o-p">{{ item.name }}</view>
                  <text class="o-small">单号：{{ item.express_no }}</text>
                </view>

                <view class="rightItem">
                  <image src="/static/images/icon/icon_arror_right.png" mode="aspectFit"></image>
                </view>
              </view>
            </view>
          </view>
        </view>
        <view class="consignee address-box">
          <view class="sLine padding-32">
            <view class="lCont addressBox">
              <image src="/static/images/icon/icon_address.png" class="address-icon" mode="aspectFit"></image>
              <view class="addressItem">
                <view class="editRow">
                  <view class="o-p">
                    收货人: {{ orderObject.consignee ? orderObject.consignee : '' }}
                  </view>
                  <view class="o-b">
                    {{ orderObject.consignee_mobile_region ? orderObject.consignee_mobile_region : '' }}  {{ orderObject.consignee_mobile ? orderObject.consignee_mobile :'' }}
                  </view>
                </view>
                <view v-if="orderObject.consignee_address" class="detail">{{ orderObject.consignee_address }}</view>
              </view>
            </view>
            <view class="rCont">
              <!-- <image src="/static/images/icon/icon_arror_right_grey.png"></image> -->
            </view>
          </view>
        </view>
        <view class="product-all">
          <goods-item
            :shopping-items="orderObject.shopping_items"
            @saleReturnDetail="saleReturnDetail"
            @toSaleReturn="toSaleReturn"
          ></goods-item>
        </view>
        <view v-if="taxDetail.invoiceTitle" class="price-all tax-all">
          <view class="tax-all-item"><text class="tax-all-txt">发票类型：</text><text>电子普通发票</text><text v-if="showFaxBtn" class="look-btn" @click="lookTax">查看发票</text></view>
          <view class="tax-all-item"><text class="tax-all-txt">发票抬头：</text><text>{{ taxDetail.invoiceTitle }}</text></view>
          <view class="tax-all-item"><text class="tax-all-txt">发票内容：</text><text>{{ taxDetail.invoiceContent }}</text></view>
          <view v-if="taxDetail.taxpayerIdentifyNo" class="tax-all-item"><text class="tax-all-txt">纳税人识别号：</text><text>{{ taxDetail.taxpayerIdentifyNo }}</text></view>
        </view>
        <view class="price-all">
          <view class="price-detail">
            <view class="sLine">
              <view class="lCont">
                <text class="o-span">商品金额</text>
              </view>
              <view class="rCont">
                <text v-if="orderObject.goods_total " class="o-span">¥{{ orderObject.goods_total | formatMoney }}</text>
                <text v-else class="o-span">-¥0.00</text>
              </view>
            </view>
            <view v-if="orderObject.discount_activity" class="sLine">
              <view class="lCont">
                <text class="o-span">促销特惠</text>
              </view>
              <view class="rCont">
                <text v-if="orderObject.discount_activity" class="o-span">-¥{{ orderObject.discount_activity | formatMoney }}</text>
                <text v-else class="o-span">-¥0.00</text>
              </view>
            </view>
            <view v-if="orderObject.discount_hongbao" class="sLine">
              <view class="lCont">
                <text class="o-span">红包减免</text>
              </view>
              <view class="rCont">
                <text v-if="orderObject.discount_hongbao" class="o-span">-¥{{ orderObject.discount_hongbao | formatMoney }}</text>
                <text v-else class="o-span">-¥0.00</text>
              </view>
            </view>
            <view class="sLine">
              <view class="lCont">
                <text class="o-span">优惠金额</text>
              </view>
              <view class="rCont">
                <text v-if="orderObject.discount_coupon" class="o-span">-¥{{ orderObject.discount_coupon | formatMoney }}</text>
                <text v-else class="o-span">-¥0.00</text>
              </view>
            </view>
            <view class="sLine">
              <view class="lCont">
                <text class="o-span">会员立减</text>
              </view>
              <view class="rCont">
                <text v-if="orderObject.discount_member " class="o-span">-¥{{ orderObject.discount_member | formatMoney }}</text>
                <text v-else class="o-span">-¥0.00</text>
              </view>
            </view>
            <view v-if="orderObject.discount_promotion" class="sLine">
              <view class="lCont">
                <text class="o-span">活动立减</text>
              </view>
              <view class="rCont">
                <text v-if="orderObject.discount_promotion" class="o-span">-¥{{ orderObject.discount_promotion | formatMoney }}</text>
                <text v-else class="o-span">-¥0.00</text>
              </view>
            </view>
            <view class="sLine">
              <view class="lCont">
                <text class="o-span">邮费</text>
              </view>
              <view class="rCont">
                <text v-if="orderObject.express_fee" class="o-span">¥{{ orderObject.express_fee | formatMoney }}</text>
                <text v-else class="o-span">包邮</text>
              </view>
            </view>
            <view class="sLine">
              <view class="lCont">
                <text class="o-span">合计</text>
              </view>
              <view class="rCont">
                <text class="o-span">¥{{ orderObject.total | formatMoney }}</text>
              </view>
            </view>
          </view>
        </view>
        <view class="price-all">
          <view class="price-detail">
            <view class="sLine">
              <view class="lCont">
                <text class="o-span">可用余额抵扣</text>
              </view>
              <view class="rCont">
                <text class="o-span">¥{{ orderObject.available_balance_pay_amt | formatMoney }}</text>
              </view>
            </view>
          </view>
          <view class="price-detail">
            <view class="sLine">
              <view class="lCont">
                <text class="o-span">在线支付</text>
              </view>
              <view class="rCont">
                <text class="o-span">¥{{ orderObject.channel_pay_amt | formatMoney }}</text>
              </view>
            </view>
          </view>
        </view>
        <view class="price-all">
          <view class="sLine order-line">
            <view class="lCont">
              订单编号 <text class="o-b">{{ orderObject.order_no }}</text>
            </view>
            <view class="rCont copyBtn" @click="handleCopy(orderObject.order_no, $event)">复制</view>
          </view>
          <view class="sLine order-line">
            <view class="lCont">
              下单时间 <text class="o-b">{{ _parseTime(orderObject.order_time, '{y}-{m}-{d} {h}:{i}:{s}') }}</text>
            </view>
          </view>
          <view class="sLine order-line">
            <view class="lCont">
              下单备注 <text class="o-b">{{ orderObject.remark || '无' }}</text>
            </view>
          </view>
        </view>
      </view>

      <!-- 退款 -->
      <view v-if="refundDialog" class="refundDialog">
        <view class="maskBox" @click="refundDialog = false" @touchmove.prevent></view>
        <view class="orderList">
          <view v-for="(item, index) in refundOrderList" :key="index" class="listItem">
            <view class="orderNo">退单号: {{ item.refund_no }}
              <text class="o-span">{{ _getRefundStateText(item.status) }}</text>
            </view>
            <view class="goodsList" @click.prevent.stop="toSaleReturnDetail(item)">
              <goods-item :shopping-items="item.shopping_items" :prevent-click="true"></goods-item>
            </view>
            <view class="itemFooter">
              <view>
                <view class="rowButton">
                  <text class="theme" @click.prevent.stop="toSaleReturnDetail(item)">查看详情</text>
                </view>
              </view>
            </view>
          </view>
        </view>
      </view>
      <view v-if="orderStatus === '待付款'" class="paySection">
        <view class="bottomFix">
          <view class="bottom-container">
            <view class="lPrice">
              <!-- <text class="o-span">合计: </text> -->
              <!-- <text class="o-b">¥{{ orderObject.total | formatMoney }}</text> -->
            </view>
            <view class="button-box">
              <view class="rButton rgButton" @click="cancalOrder(orderObject)">
                取消订单
              </view>
              <view class="rButton" @click="showPay()">
                去付款
              </view>
            </view>
          </view>
        </view>
      </view>
      <view v-if="orderStatus === '待收货' || orderStatus === '部分发货'" class="paySection">
        <view class="bottomFix">
          <view class="bottom-container">
            <view class="lPrice"></view>
            <view class="button-box">
              <view class="rButton rgButton" @click="toOrderExpress">
                查看物流
              </view>
              <view class="rButton" @click="confirmReceipt">
                确认收货
              </view>
            </view>
          </view>
        </view>
      </view>
      <view v-if="orderStatus === '订单成功' && orderObject.comment_status == 2" class="paySection">
        <view class="bottomFix">
          <view class="bottom-container">
            <view class="lPrice">
            </view>
            <view v-if="taxDetail.invoiceRestart === 1" class="rButton" style="margin-left: 200rpx;" @click="showTax=true">
              重新开票
            </view>
            <view class="rButton" @click="toEvaluation(orderObject, 'edit')">
              我的评价
            </view>
          </view>
        </view>
      </view>
      <view v-if="orderStatus === '订单已签收' && orderObject.comment_status === 1" class="paySection">
        <view class="bottomFix">
          <view class="bottom-container">
            <view class="lPrice">
            </view>
            <view v-if="taxDetail.invoiceRestart === 1" class="rButton" style="margin-left: 200rpx;" @click="showTax=true">
              重新开票
            </view>
            <view class="rButton" @click="toEvaluation(orderObject)">
              立即评价
            </view>
          </view>
        </view>
      </view>
      <view v-if="orderStatus === '待分享'" class="paySection">
        <view class="bottomFix">
          <view class="bottom-container">
            <view class="lPrice">
              <!-- <text class="o-span">合计金额: </text>
              <text v-if="orderObject.total" class="o-span">¥{{ orderObject.total | formatMoney }}</text> -->
            </view>
            <view class="rButton relative-container">
              邀请好友拼单
              <b-open-type open-type="share" :option="shareOption" />
            </view>
          </view>
        </view>
      </view>
    </view>
    <pay-dialog ref="payDialog" :order-no="orderNo" @submitCallBack="toPayResult"></pay-dialog>
    <confirm-popup ref="confirm">
      <view v-if="orderObject.pay_expiry" slot="content">
        您的订单在<count-down color="#000" padding="0" margin="0" splitor-color="#000" :second="orderObject.pay_expiry" :show-day="false" :show-hour="false" />内未支付将被取消，请尽快完成支付
      </view>
    </confirm-popup>
    <block v-if="taxDetail.invoiceRestart === 1">
      <tax-com
        :show="showTax"
        @close="showTax=false"
        @deliver="getTaxData"
      />
    </block>
    <!-- 验证码弹窗 -->
    <codePopup ref="codePopup" @again="sendCode" @success="code=>checkCode(code)"/>
    <!-- 交易密码弹窗 -->
    <dealPassword ref="dealPassword" v-if="showDealPassword" @complete="completePassword" @close="closeDealPassword"></dealPassword>  
  </base-page-view>
</template>
<script>
import '../orderCheck/index.scss'
import './index.scss'
import { mapGetters } from 'vuex'
import payDialog from '../components/payDialog'
import dealPassword from '@/components/pay/dealPassword'
import goodsItem from '../components/goodsItem'
import taxCom from '../components/taxCom'
import confirmPopup from '@/components/confirmPopup/index'
import { getOrderStateIcon, getUserLevel, toGoods, getOrderState, getRefundStateText } from '@/utils/common'
import countDown from '@/components/count-down/index'
import { navigateToMiniProgram, toMpHomePage, pageNavigateBack } from '@/utils/navigateTo'
import { parseTime, setClipboardData, getQueryString } from '@/utils/tools'
import codePopup from '@/components/popup/codePopup'
export default {
  components: {
    goodsItem,
    payDialog,
    countDown,
    confirmPopup,
    taxCom,
    codePopup,
    dealPassword
  },
  data() {
    return {
      shareOption: {}, // 分享自定义设置
      orderNo: '',
      orderObject: {},
      refundDialog: false,
      refundOrderList: [],
      showPayPop: false,
      taxDetail: {
        invoiceRestart: 0
      },
      showTax: false,
      showDealPassword: false
    }
  },
  onLoad(options) {
    this.orderNo = options.orderNo
  },
  onShow() {
    this.getOrderStatus()
  },
  computed: {
    orderStatus() {
      if (!this.orderObject) return ''
      if (this.orderObject.status === 5 || this.orderObject.status === 7) {
        return '已取消'
      } else if (this.orderObject && this.orderObject.comment_status === 2 && this.orderObject.status === 4) {
        return '订单成功'
      } else if (this.orderObject.status === 4 && this.orderObject.comment_status !== 1) {
        return '已完成'
      }
      return this._getOrderState(this.orderObject.status)
    },
    orderStateIcon() {
      if (!this.orderObject) return ''
      return this._getOrderStateIcon(this.orderObject.status)
    },
    showFaxBtn() {
      if (!this.orderObject) {
        return false
      }
      const arr = [2, 3, 4, 10, 11]
      return arr.includes(this.orderObject.status)
    },
    ...mapGetters([
      'user',
      'extraData'
    ])
  },
  destroyed() {
    // #ifdef H5
    // 当页面销毁必须要移除这个事件，vue不刷新页面，不移除会重复执行这个事件
    // window.removeEventListener('popstate', this.onBrowserBack, false)
    // #endif
  },
  onShareAppMessage(res) {
    if (this.orderStatus === '待分享') {
      this.$sensorTrack('buttonClick', {
        button_name: '邀请好友拼单',
        button_key: 'group_invite_friend',
        page_name: '订单详情'
      })
    }
    return this.$queryShareOption(res, this.shareOption)
  },
  methods: {
    // 获取订单详情信息
    async getOrderStatus() {
      const res = await this.$api.orderApi.getOrderDetail({
        order_no: this.orderNo
      })
      if (res.success) {
        this.orderObject = res.data
        this.initShare()
        this.getInvoiceDetail()
      }
      // #ifdef H5
      // if (res.data.invite_btn) {
      //   setTimeout(() => {
      //     this.toShare(res.data.invite_btn)
      //   }, 1000)
      // }
      // #endif
    },
    // 下单
    showPay() {
      //在线支付金额为0时使用短信弹窗验证
      if(this.orderObject.channel_pay_amt==0){
        this.showDealPassword = true
        // this.$refs.codePopup.show();//显示验证码弹窗
        this.sendCode();//发送验证码
      }else{
        this.$refs.payDialog.show()
      }
    },
    closeDealPassword() {
      this.showDealPassword = false
    },
    async getPublicKey() {
      let res = await this.$api.mineApi.tradePasswordGetPublicKey()
      if (res.code === 0) {
        this.publicKey = res.data
      }
    },
    // 交易密码输入完成
    async completePassword(str){
      await this.getPublicKey()
       // 加密, 提交
      let jse = new this.$jsEncrypt()
      jse.setPublicKey(this.publicKey)
      let encrypted = jse.encrypt(str)
      this.checkCode(encrypted)
    },
    //发送验证码
    sendCode(){
      this.$api.orderApi.orderPay({
        pay_channel:11, // pay_channel为9时发送验证码,
        order_no: this.orderNo
      }).then(res=>{
        if(res.code==0){
          // this.$msg("验证码发送成功");
          // this.$refs.codePopup.countDown();//验证码倒计时
        }
      })
    },
    //判断验证码是否正确
    checkCode(password){
      this.$api.orderApi.checkVerifyDealPassword({
        password: password, 
        order_no: this.orderNo
      }).then(res=>{
        this.showDealPassword = false
        // this.$refs.codePopup.close();//关闭验证码弹窗
        this.$navigateTo('/pagesOrder/orderSuccess/index?orderNo=' + this.orderNo)
      }).catch((err)=>{
        // 1000002
        if(err.code === 1000002){
          this.showDealPassword = false
          uni.showToast({
            title: "未设置密码，请先设置",
            icon: 'none',
            duration: 2000
          })
          setTimeout(() => {
            this.$navigateTo("/pagesMine/dealPassword/index")
          }, 2000);
        }else{
          // 清除密码
          this.$refs.dealPassword.clearPassword()
          uni.showToast({
            title: err.msg,
            icon: 'none',
            duration: 3 * 1000
          })
        }
      });
    },
    toPayResult(data) {
      // #ifdef H5
      if (data.type === '2') {
        let wechatUrl = data.url
        wechatUrl += `&redirect_url=${encodeURIComponent(location.origin + '/pagesOrder/orderSuccess/index?order_no=' + this.orderNo)}`
        location.href = wechatUrl
      }
      // #endif
      // #ifdef MP-WEIXIN
      this.$navigateTo('/pagesOrder/orderSuccess/index?orderNo=' + this.orderNo)
      // #endif
    },
    // 取消订单
    cancalOrder(item) {
      this.$refs.confirm.show({
        title: '提示',
        content: '是否取消订单',
        yesCb: async() => {
          const res = await this.$api.orderApi.orderCancel({
            order_no: item.order_no
          })

          if (res.success) {
            this.getOrderStatus()
            uni.showToast({
              title: '取消成功',
              icon: 'none',
              duration: 2000,
              mask: true
            })
          }
        }
      })
    },
    // 确认收货
    confirmReceipt() {
      this.$refs.confirm.show({
        title: '提示',
        content: '是否确定收货',
        yesCb: async() => {
          const res = await this.$api.orderApi.orderConfirm({
            order_no: this.orderNo
          })
          if (res.success) {
            this.orderObject = {}
            this.getOrderStatus()
            uni.showToast({
              title: '确认收货成功',
              icon: 'none',
              duration: 2000,
              mask: true
            })
          }
        }
      })
    },
    toOrderExpress(index) {
      let url = `/pagesOrder/orderExpress/index?orderNo=${this.orderNo}`
      if (index > 0) {
        url += `&packageNo=${index}`
      }
      this.$navigateTo(url)
    },
    callBack() {
      this.orderObject.status = 7
      // this.$sensorTrack('cancelPayOrder', {
      //   order_id: this.orderObject.order_no,
      //   order_amount: this.orderObject.goods_total,
      //   actual_payment_amount: this.orderObject.total,
      //   payment_method: '',
      //   is_use_discount: this.orderObject.discount_coupon > 0,
      //   discount_name: '',
      //   discount_amount: this.orderObject.discount_coupon,
      //   transportation_costs: this.orderObject.express_fee,
      //   deliveryMethod: ''
      // })
    },
    // 复制
    handleCopy(data, e) {
      setClipboardData({
        data: data
      })
    },
    // 返回
    leftClick() {
      if (this.orderStatus === '待付款') {
        this.$refs.confirm.show({
          title: '确认要离开收银台?',
          content: '',
          cancleTxt: '放弃支付',
          yesTxt: '继续支付',
          cancleCb: () => {
            this.fromOtherMini()
          }
        })
      } else {
        this.fromOtherMini()
      }
    },
    fromOtherMini() {
      if (this.extraData && this.extraData.platform) {
        navigateToMiniProgram({
          success: () => {
            console.log('返回成功')
            this.$store.dispatch('setExtraData', null)
            this.$store.dispatch('setGoodsTemp', null)
            toMpHomePage()
          }
        })
      } else {
        /* eslint-disable */
        const pages = getCurrentPages()
        /* eslint-disable-end */
        if (pages.length >= 2) {
          if (this.$prePage() && this.$prePage().resetUp) {
            this.$prePage().resetUp()
          }
        }
        setTimeout(() => {
          pageNavigateBack()
        }, 800)
      }
    },
    toSaleReturnDetail(item) {
    },
    _getUserLevel(id) {
      return getUserLevel(id)
    },
    _toGoods(item) {
      toGoods(item, 'navigateTo', {
        preseat: item.title,
        firstseat: '订单详情'
      })
    },
    toEvaluation(item, type) {
      // this.$refs.confirm.show({
      //   title: '',
      //   content: '该功能还未开放，目前只对少量的用户开放测试，为您带来不便敬请谅解。',
      //   cancleTxt: '',
      //   contentStyle: 'padding: 60rpx 40rpx;color: #666',
      //   yesTxt: '好的'
      // })
      this.$navigateTo(`/pagesOrder/orderEvalu/index?orderNo=${item.order_no}&type=${type}`)
    },
    // 获取发票详情
    async getInvoiceDetail(){
      const res = await this.$api.invoiceApi.getInvoiceDetail({
        orderNo: this.orderNo
      })
      if (res.success && res.data){
        this.taxDetail = res.data
      }
    },
    // 查看发票
    lookTax() {
      this.$navigateTo('/pagesOrder/taxDetail/index?orderNo=' + this.orderNo+'&orderStatus='+this.orderObject.status)
    },
    // 获取发票数据
    async getTaxData(data) {
      this.taxInfo = data
      if(this.taxInfo.invoiceContent === '不开发票') {
        return
      }
      if (this.taxInfo.from === 'sureBtn') {
        // 确认申请
        this.taxInfo.orderNo = this.orderNo
        const data = {
          email: this.taxInfo.email,
          gmfBankAccount: this.taxInfo.gmfBankAccount,
          gmfOpenBank: this.taxInfo.gmfOpenBank,
          gmfRegisterAddress: this.taxInfo.gmfRegisterAddress,
          gmfRegisterPhone: this.taxInfo.gmfRegisterPhone,
          gmfTaxpayerIdentifyNo: this.taxInfo.gmfTaxpayerIdentifyNo,
          invoiceTitle: this.taxInfo.invoiceTitle,
          invoiceTitleType: this.taxInfo.invoiceTitleType,
          orderNo: this.taxInfo.orderNo
        }
        const res = await this.$api.invoiceApi.reApplyInvoice(data)
        if (res.success) {
           this.getOrderStatus()
        }
      }
    },
    _parseTime(time, format) {
      if (!time) return ''
      return parseTime(time, format)
    },
    _getOrderState(item) {
      return getOrderState(item)
    },
    _getRefundStateText(type) {
      return getRefundStateText(type)
    },
    _getOrderStateIcon(item) {
      return getOrderStateIcon(item)
    },
    // 分享初始化
    initShare() {
      const info = this.orderObject.invite_btn
      if (this.orderStatus === '待分享' && info && info.url) {
        // 替换url
        let share_url = info.url
        if (share_url.match('/#/')) {
          const urlArr = share_url.split('/#/')
          share_url = urlArr[1].replace('detail/goods', '/pagesDetail/commodity/index')
        } else {
          const url = getQueryString('path', share_url)
          share_url = decodeURIComponent(url)
          // console.log(share_url, 6666)
        }
        this.shareOption = {
          share_title: info.title,
          share_url: share_url,
          share_icon: info.pic,
          share_image: info.pic,
          share_content: info.content
        }
        this.showShare()
      } else {
        this.hideShare()
      }
    }
  }
}
</script>
